![]() |
PATH![]() |
![]() ![]() |
A compound If statement contains one or more Boolean expressions and groups of statements to be executed if the value of the corresponding Boolean expression is true .
if Boolean [ then ]
[ statement ]...
[ else if Boolean [ then ]
[ statement ]...]...
[ else
[ statement ]...]
end [ if ]
The following example creates a string that specifies whether one value is greater than, less than, or the same as a second value.
if ( x > y ) then
set myMessage to " is greater than "
else if ( x < y ) then
set myMessage to " is less than "
else
set myMessage to " is equal to "
end if
set myResult to (x as string) & myMessage & (y as string)